I'm trying to do a simple update on the database but I got an error, I think its is a PDO issue, but I couldn't find the solution, I don't know what more can I do, I use Phalcon 2.0.7
ERROR: SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens
Example Url: https://domain.com/controller/hide/8
On my Controller:
public function hideAction($id) {
$query = Table::findFirst($id);
$query->active = 0;
$query->save();
}
but also I try this:
public function hideAction($id) {
$query = Table::findFirst($id);
$query->save([
'active' => 0
]);
}
On my Model:
use Phalcon\Mvc\Model;
class Table extends Model {
public $id;
public $active;
public $title;
public function initialize() {
}
public function getSource() {
return 'table_sample';
}
That my dispatcher service for the database connection:
$di->set('db', function() use ($config) {
return new \Phalcon\Db\Adapter\Pdo\Mysql(
array(
"host" => $config->db->host,
"username" => $config->db->username,
"password" => $config->db->password,
"dbname" => $config->db->dbname
)
);
});
As you can see is a simple update, probably Im missing something